package fun.hijklmn.magic.common.vo.req;

import lombok.Data;

import java.io.Serializable;

/**
 * @Description
 * @Author fs
 * @Date 2021/4/29 16:11
 * @Version 0.0.1-SNAPSHOT
 **/
@Data
public class PageVO implements Serializable {

    private Integer currentPage = 1;

    private Integer pageSize = 10;

    private Integer startIndex;

    private Integer endIndex;

    public Integer getStartIndex() {
        if (currentPage < 1) {
            currentPage = 1;
        }
        return (currentPage - 1) * pageSize;
    }

    public Integer getEndIndex() {
        if (currentPage < 1) {
            currentPage = 1;
        }
        if (pageSize < 1) {
            pageSize = 10;
        }
        return currentPage * pageSize;
    }

}
